Skip to content

Conversation

@nickgros
Copy link
Contributor

@nickgros nickgros commented Oct 15, 2025

Reasons for making this change

Convert the LayoutGridField into function components

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests. I've run npx nx run-many --target=build --exclude=@rjsf/docs && npm run test:update to update snapshots, if needed.
    • I've updated docs if needed
    • I've updated the changelog with a description of the PR
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

Copy link
Member

@heath-freenome heath-freenome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides moving everything around so that things aren't used before they are defined, I'd say it looks good. IF you do decide to go with a hook (in @rjsf/utils), it probably makes sense to also update my ObjectField refactor to use it too.

"homepage": "https://github.com/rjsf-team/react-jsonschema-form",
"publishConfig": {
"access": "public"
},
Copy link
Member

@heath-freenome heath-freenome Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YAY! This helps a lot

LayoutGridField:
- Deep compare memoize the fieldPathId
- Move helper functions in LayoutGridField
- Update docs comments in LayoutGridField
- Attach TEST_IDS to LayoutGridField function

Additionally:
- Update migration guide per rjsf-team#4808
@nickgros nickgros marked this pull request as ready for review October 18, 2025 17:22
Copy link
Member

@heath-freenome heath-freenome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm approving but there are a few simple changes that you can make first.

} = getSchemaDetailsForField<T, S, F>(registry, name, initialSchema, formData, fieldPathId);
const memoFieldPathId = useDeepCompareMemo<FieldPathId>(fieldIdSchema);

if (uiComponentProps.rendered) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It kind of sucks that the rules of hooks forces us to call that rather expensive getSchemaDetailsForField() first

- Move LayoutGridFieldChildren component definition above usage
- LayoutGridFieldComponent": Simplify props destructure
- Fix issue with the nx dependency graph - dependencies were not tracked
@heath-freenome heath-freenome merged commit 4ab0f39 into rjsf-team:main Oct 22, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants